﻿<!-- #include file="../Include/Admin_Onlogin.asp" -->
<!-- #include file="../../Include/SendMail.asp" -->
<%
CheckPurview 49,0
Response.Write "<!DOCTYPE html>" & vbCrLf
Response.Write "<head>" & vbCrLf
Response.Write "<title>邮件列表管理</title>" & vbCrLf
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
Response.Write "<script type='text/javascript'>" & vbCrLf
Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
Response.Write "</script>" & vbCrLf
Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
Response.Write "<script type='text/javascript' src='"&InstallDir&"UEditor/ueditor.config.js'></script>" & vbCrLf
Response.Write "<script type='text/javascript' src='"&InstallDir&"UEditor/ueditor.all.js'></script>" & vbCrLf
Response.Write "</head>" & vbCrLf
Response.Write "<body>" & vbCrLf
Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrLf
Response.Write "<div class=""table-responsive"">" & vbCrLf
Response.Write "<table class=""layui-table table-hover"">" & vbCrLf
Response.Write "  <tr class='title'>" & vbCrLf
Response.Write "    <td colspan='2'><strong>邮 件 列 表 管 理</strong></td>" & vbCrLf
Response.Write "  </tr>" & vbCrLf
Response.Write "  <tr>" & vbCrLf
Response.Write "    <td width='70'><strong>管理导航：</strong></td>" & vbCrLf
Response.Write "    <td><a href='Admin_Maillist.asp'>发送邮件列表</a>&nbsp;|&nbsp;<a href='Admin_Maillist.asp?Action=Export'>导出邮件列表</a></td>" & vbCrLf
Response.Write "  </tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
Response.Write "</div>" & vbCrLf

ObjInstalled_FSO = IsObjInstalled(Fso_Sys)
If ObjInstalled_FSO = True Then
	Set Fso = Server.CreateObject(Fso_Sys)
Else
	Response.Write "<li>FSO组件不可用，各种与FSO相关的功能都将出错！请运到后台网站配置处设置好FSO组件名称。</li>"
End If

Action = Trim(Request("Action"))
Select Case Action
Case "Send"
    Call SendMaillist
Case "Export"
    Call ExportMail
Case "DoExport"
    Call DoExportMail
Case Else
    Call main
End Select
If FoundErr = True Then
	Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</div></body></html>"
Call CloseConn()

Sub Main()
    Dim reSend
    Dim UserType, UserName
    UserType = Code_CLng(Trim(Request("UserType")))
    UserName = Trim(Request("UserName"))
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function CheckForm(){" & vbCrLf
    Response.Write "  if (document.myform.subject.value==''){" & vbCrLf
    Response.Write "     Dialog.alert('邮件主题不能为空！', function() {document.myform.subject.focus();});" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  content = UE.getEditor('Content').getContent();" & vbCrlf
    Response.Write "  if(isEmpty(content)){" & vbCrLf
    Response.Write "     Dialog.alert('邮件内容不能为空！', function() {UE.getEditor('Content').focus();});" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.SendperPage.value==''){" & vbCrLf
    Response.Write "     Dialog.alert('发送数量不能为空！', function() {document.myform.SendperPage.focus();});" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    
    Response.Write "  return true;" & vbCrlf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
    Response.Write "<br><form name='myform' method='post' onSubmit='return CheckForm();' action='Admin_Maillist.asp'>"
	Response.Write "<div class=""table-responsive"">" & vbCrLf
    Response.Write "<table class=""layui-table table-hover"">"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td height='22' class='title' colspan=2 align=center><b> 邮 件 列 表</b></td>"
    Response.Write "  </tr>"
    
    Response.Write "    <tr>"
    Response.Write "      <td align='right'>收件人选择：</td>"
    Response.Write "      <td><table><tr><td><input type='radio' name='InceptType' value='0'"
    If UserType = 0 Then Response.Write " checked"
    Response.Write "> 所有会员</td><td></td></tr>"
    Response.Write "<tr><td valign='top'><input type='radio' name='InceptType' value='1'"
    If UserType = 1 Then Response.Write " checked"
    Response.Write "> 指定会员组</td><td>" & GetUserGroup("", "") & "</td></tr>"
    Response.Write "<tr><td valign='top'><input type='radio' name='InceptType' value='2'"
    If UserType = 2 Then Response.Write " checked"
    Response.Write "> 指定用户名</td><td><input type='text' name='inceptUser' size='40' value='" & UserName & "'>"
    Response.Write "多个用户名间请用<font color='#0000FF'>英文的逗号</font>分隔</td></tr>"
    Response.Write "<tr><td valign='top'><input type='radio' name='InceptType' value='3'"
    If UserType = 3 Then Response.Write " checked"
    Response.Write "> 指定会员Email</td><td><input type='text' name='InceptEmail' size='40'>"
    Response.Write "多个Email间请用<font color='#0000FF'>英文的逗号</font>分隔</td></tr></table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    
    Response.Write "  <tr>"
    Response.Write "    <td width='15%' align='right'>邮件主题：</td>"
    Response.Write "    <td width='85%'>"
    Response.Write "      <input type=text name=subject size=64>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td align='right'>邮件内容：</td>"
    Response.Write "    <td>"
    Response.Write "      <textarea id='Content' name='Content'></textarea>"
	Response.Write "       <script type=""text/javascript"">"
	Response.Write "       var editor = UE.getEditor('Content',{serverUrl:'"&InstallDir&AdminFolder&"/Include/Upload.asp',toolbars:[['Source','Undo', 'Redo','|','Bold','Italic','Underline','ForeColor','BackColor','|','FontFamily', 'FontSize','|','JustifyLeft','JustifyCenter','JustifyRight','JustifyJustify','|','Simpleupload','Link','Unlink','AutoTypeSet','FullScreen']],initialFrameWidth:'650',initialFrameHeight:'160'});"
	Response.Write "       </script>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td width='15%' align='right'>发件人：</td>"
    Response.Write "    <td width='85%'>"
    Response.Write "      <input type='text' name='sendername' size='64' value='" & SiteName & "'>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td width='15%' align='right'>发件人Email：</td>"
    Response.Write "    <td width='85%'>"
    Response.Write "      <input type='text' name='senderemail' size='64' value='" & WebmasterEmail & "'>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    
    Response.Write "  <tr>"
    Response.Write "    <td width='15%' align='right'>每次发送数量：</td>"
    Response.Write "    <td width='85%'>"
    Response.Write "      <input type='text' name='SendperPage' size='5' value='100'>封邮件"
    Response.Write "    </td>"
    Response.Write "  </tr>"
        
    Response.Write "  <tr>"
    Response.Write "    <td align='right'>邮件优先级：</td>"
    Response.Write "    <td>"
    Response.Write "      <input type='radio' name='Priority' value='1'>"
    Response.Write "      高"
    Response.Write "      <input type='radio' name='Priority' value='3' checked>"
    Response.Write "      普通"
    Response.Write "      <input type='radio' name='Priority' value='5'>"
    Response.Write "      低"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td colspan=2 align=center>"
    Response.Write "      <input name='Action' type='hidden' id='Action' value='Send'>"
    Response.Write "      <input name='SendCount' type='hidden' id='SendCount' value='1'>"
    Response.Write "      <button type=""submit"" class=""layui-btn"" hidefocus=""true""> 发 送 </button>&nbsp;"
    Response.Write "      <button type=""reset"" class=""layui-btn"" hidefocus=""true""> 清 除 </button>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>"
	Response.Write "</div>" & vbCrLf
    Response.Write "</form>"
End Sub

Sub SendMaillist()
    Dim sql, rs
    Dim totalsend, SendperPage, sendMsg, sendCount, endCount
    Dim Sendername, Senderemail, Subject, Content, Priority, InceptType, GroupID, inceptUser, InceptEmail, i, j, k
    i = 0
    j = 0
    k = 0
    sendMsg = ""
    sendCount = Code_CLng(Request("SendCount"))
    If sendCount < 1 Then sendCount = 1
    Sendername = Trim(Request("sendername"))
    Senderemail = Trim(Request("senderemail"))
    Subject = Trim(Request("Subject"))
    '增加邮件内容的编辑器
    Content = Trim(Request("Content"))
    Priority = Trim(Request("Priority"))
    SendperPage = Code_CLng(Request("SendperPage"))
    If Sendername = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>发件人不能为空！</li>"
    End If
    If Senderemail = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>发件人Email不能为空！</li>"
    End If
    If Subject = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>邮件主题不能为空！</li>"
    End If
    If Content = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>邮件内容不能为空！</li>"
    End If
    If Priority = "" Then
        Priority = 3
    End If

    If FoundErr = True Then
        Exit Sub
    End If

    InceptType = CLng(Request("inceptType"))
    sql = "select UserName,Email from [User] "
    If InceptType = 0 Then
        sql = sql & " where 1=1"
    ElseIf InceptType = 1 Then
        GroupID = Trim(Request("GroupID"))
        If IsValidID(GroupID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定会员组！</li>"
            Exit Sub
        End If
        If InStr(GroupID, ",") > 0 Then
            sql = sql & " where GroupID in (" & GroupID & ")"
        Else
            sql = sql & " where GroupID=" & GroupID
        End If
    ElseIf InceptType = 2 Then
        inceptUser = Replace(ReplaceBadChar(Request("InceptUser")), ",", "','")
        If inceptUser = "" Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定收信人的用户名！</li>"
            Exit Sub
        End If
        sql = sql & " where UserName in ('" & inceptUser & "')"
    ElseIf InceptType = 3 Then
        InceptEmail = Replace(ReplaceBadChar(Request("InceptEmail")), ",", "','")
        If InceptEmail = "" Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请指定收信人的邮箱！</li>"
            Exit Sub
        End If
        sql = sql & " where Email in ('" & InceptEmail & "')"
    End If
    
    Call Exe_Conn(rs,sql,1)
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>暂时没有会员注册！</li>"
    Else
        sendMsg = sendMsg & "<li>正在发送中，请等待</li>"
        totalsend = rs.RecordCount
        endCount = sendCount + SendperPage - 1
        'Response.write "start:" &sendCount &"<br>"
        If endCount >= totalsend Then
            endCount = totalsend
        End If
        'Response.write "end:" &endCount &"<br>"
        'Response.write Content
        If Not rs.EOF Then
            If sendCount > 1 And sendCount <= endCount Then
                rs.Move sendCount - 1
            End If
        End If
        Do While Not rs.EOF
            If IsValidEmail(rs("Email")) = True Then
                ErrMsg = Mail.Send(rs("Email"), rs("UserName"), Subject, Content, Sendername, Senderemail, Priority)
                If ErrMsg = "" Then
                    i = i + 1
                    sendMsg = sendMsg & "<li>成功向 " & rs("UserName") & " 发送邮件！</li>"
                Else
                    j = j + 1
                    sendMsg = sendMsg & "<li><font color='red'>向 " & rs("UserName") & " 发送邮件失败！失败原因：" & ErrMsg & "</font></li>"
                End If
            Else
                k = k + 1
            End If
            sendCount = sendCount + 1
            If sendCount > endCount Then Exit Do
            rs.MoveNext
        Loop
        sendMsg = sendMsg & "<li>成功发送邮件：" & i & "封</li>"
        If j > 0 Then sendMsg = sendMsg & "<li>发送邮件失败：" & j & "封<li>"
        If k > 0 Then sendMsg = sendMsg & "<li>未发送邮件：" & j & "封（邮件地址错误）<li>"
        If sendCount > totalsend Then
            Response.Write sendMsg
        Else
            If sendCount <= totalsend Then
                endCount = sendCount + SendperPage - 1
                If endCount >= totalsend Then
                    endCount = totalsend
                End If
                Response.Write "<div align='left'><form name=""sendmail"" method='post' action=""Admin_Maillist.asp?Action=Send"">" & vbCrLf
                Response.Write "共" & totalsend & "封邮件,发送第" & sendCount & "封至第" & endCount & "封邮件" & vbCrLf
                Response.write "<input type='hidden' name='sendername' value='"&Sendername&"'>" &vbCrLf
                Response.write "<input type='hidden' name='senderemail' value='"&Senderemail&"'>" &vbCrLf
                Response.write "<input type='hidden' name='Subject' value='"&Subject&"'>" &vbCrLf
                Response.write "<input type='hidden' name='Content' value='"&Content&"'>" &vbCrLf
                Response.write "<input type='hidden' name='Priority' value='"&Priority&"'>" &vbCrLf
                Response.write "<input type='hidden' name='SendperPage' value='"&SendperPage&"'>" &vbCrLf
                Response.write "<input type='hidden' name='inceptType' value='"&inceptType&"'>" &vbCrLf
                Response.write "<input type='hidden' name='GroupID' value='"&GroupID&"'>" &vbCrLf
                Response.write "<input type='hidden' name='InceptUser' value='"&InceptUser&"'>" &vbCrLf
                Response.write "<input type='hidden' name='InceptEmail' value='"&InceptEmail&"'>" &vbCrLf
                Response.write "<input type='hidden' name='SendCount' value='"&sendCount&"'>" &vbCrLf
                Response.Write "<input type='submit' name='submit' value='继续发送'>" & vbCrLf
                Response.Write "</form></div>"
            End If
            Response.Write sendMsg
        End If
    End If
    rs.Close
    Set rs = Nothing
    Set Mail = Nothing
End Sub

Sub ExportMail()
    Response.Write "<br>"
	Response.Write "<div class=""table-responsive"">" & vbCrLf
    Response.Write "<form method='post' action='Admin_Maillist.asp?Action=DoExport'>"
    Response.Write "<table class=""layui-table table-hover"">"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td height='22' class='title' colspan=2 align=center><b> 邮件列表批量导出到数据库</b></td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td width='24%' height='80' align='right'>导出邮件列表到数据库：</td>"
    Response.Write "    <td width='76%' height='80'>"
    Response.Write "      <input name='ExportType' type='hidden' id='ExportType' value='1'>"
    Response.Write "      &nbsp;&nbsp;<font color=blue>导出</font>&nbsp;&nbsp;"
    Response.Write "      <div id=""GroupID_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:200px;""><input type=""text"" ztype=""select"" id=""GroupID"" name=""GroupID"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:200px;position:absolute;z-index:-1;"" onchange=""changeClassType(this.options[this.selectedIndex].value);"" value="""" startvalue=""""/><input type=""text"" id=""GroupID_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:200px;"" /><a id=""GroupID_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""GroupID_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""GroupID_ul"" style=""left:-1px; width:-1px;""><script>Combox_GroupID_Init=function(){var _el=Zving.getDom('GroupID');if(_el._components){return true;}var  _data=[];var  _DataSource;" & GetUserGroup_Option & "var combox_GroupID = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_GroupID_Init();}else{Zving.Page.onReady(Combox_GroupID_Init);}</script></div></div></div>"
    Response.Write "      &nbsp;<font color=blue>到</font>&nbsp;"
    Response.Write "      <input name='ExportFileName' type='text' id='ExportFileName' value='Maillist.mdb' size='30' maxlength='200'>&nbsp;"
    Response.Write "      <button type=""submit"" class=""layui-btn"" hidefocus=""true"">开始</button>"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>"
    Response.Write "</form>"
	Response.Write "</div>" & vbCrLf
    Response.Write "<br>"
	Response.Write "<div class=""table-responsive"">" & vbCrLf
    Response.Write "<table class=""layui-table table-hover"">"
    Response.Write "<form method='post' action='Admin_Maillist.asp?Action=DoExport'>"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td height='22' class='title' colspan=2 align=center><b>邮件列表批量导出到文本</b></td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td width='24%' height='80' align='right'>导出邮件列表到文本：</td>"
    Response.Write "    <td width='76%' height='80'>"
    Response.Write "      <input name='ExportType' type='hidden' id='ExportType' value='2'>"
    Response.Write "      &nbsp;&nbsp;<font color=blue>导出</font>&nbsp;&nbsp;"
    Response.Write "      <div id=""GroupID2_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:200px;""><input type=""text"" ztype=""select"" id=""GroupID2"" name=""GroupID2"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:200px;position:absolute;z-index:-1;"" onchange=""changeClassType(this.options[this.selectedIndex].value);"" value="""" startvalue=""""/><input type=""text"" id=""GroupID2_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:200px;"" /><a id=""GroupID2_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""GroupID2_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""GroupID2_ul"" style=""left:-1px; width:-1px;""><script>Combox_GroupID2_Init=function(){var _el=Zving.getDom('GroupID2');if(_el._components){return true;}var  _data=[];var  _DataSource;" & GetUserGroup_Option & "var combox_GroupID2 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_GroupID2_Init();}else{Zving.Page.onReady(Combox_GroupID2_Init);}</script></div></div></div>"
    Response.Write "      </select>"
    Response.Write "      &nbsp;<font color=blue>到</font>&nbsp;"
    Response.Write "      <input name='ExportFileName' type='text' id='ExportFileName' value='Maillist.txt' size='30' maxlength='200'>&nbsp;"
    Response.Write "      <button type=""submit"" class=""layui-btn"" hidefocus=""true"""
    If ObjInstalled_FSO = False Then Response.Write " disabled"
    Response.Write ">开始</button>"
    If ObjInstalled_FSO = False Then
        Response.Write "      <font color=red>你的服务器不支持 FSO! 不能使用此功能。</font>"
    End If
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>"
    Response.Write "</form>"
	Response.Write "</div>" & vbCrLf
End Sub

Sub DoExportMail()
    Dim sql, rs
    Dim ExportType, GroupID, ExportFileName, strResult, i
    ExportType = Code_CLng(Trim(Request("ExportType")))
    If ExportType = 1 Then
        GroupID = Code_CLng(Trim(Request("GroupID")))
    Else
        GroupID = Code_CLng(Trim(Request("GroupID2")))
    End If
    ExportFileName = Trim(Request("ExportFileName"))  
    If ExportFileName = "" Then
        FoundErr = True
        If ExportType = 1 Then
            ErrMsg = ErrMsg & "<li>请输入要导出的数据库文件名！</li>"
        Else
            ErrMsg = ErrMsg & "<li>请输入要导出的文本文件名！</li>"
        End If
    Else
        ExportFileName = Replace(Replace(ExportFileName, "'", ""), Chr(34), "")
    End If
    
    If GroupID = 0 Then
        sql = "select Email from [User] where Email like '%@%'"
    Else
        sql = "select Email from [User] where Email like '%@%' and GroupID=" & GroupID & ""
    End If
    Call Exe_Conn(rs,sql,1)

    i = 0
    Select Case ExportType
    Case 1
        Dim tconn, tconnstr
        Set tconn = Server.CreateObject("ADODB.Connection")
        tconnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(ExportFileName)
        tconn.Open tconnstr
        Do While Not rs.EOF
            tconn.Execute ("insert into [User] (UserEmail) values ('" & rs(0) & "')")
            rs.MoveNext
            i = i + 1
        Loop
        tconn.Close
        Set tconn = Nothing
        strResult = "操作成功：共导出 " & i & " 个会员Email地址到数据库 " & ExportFileName & "。<a href=" & ExportFileName & ">点击这里将数据库下载回本地</a>"
    Case 2
        Dim filepath, writefile
    
        Application.Lock
        filepath = Server.MapPath("" & ExportFileName & "")
        Set writefile = Fso.CreateTextFile(filepath, True)
        Do While Not rs.EOF
            writefile.WriteLine rs(0)
            rs.MoveNext
            i = i + 1
        Loop
        writefile.Close
        Application.UnLock
        strResult = "操作成功：共导出 " & i & " 个会员Email地址到" & ExportFileName & "文件。<a href=" & ExportFileName & ">点击这里将文件下载回本地</a>"
    End Select
    rs.Close
    Set rs = Nothing

    Response.Write "<br>"
	Response.Write "<div class=""table-responsive"">" & vbCrLf
	Response.Write "<table class=""layui-table table-hover"">"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td height='22' class='title' align=center><b>邮件列表批量导出反馈信息</b></td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td height='100' align='center'>" & strResult & "</td>"
    Response.Write "  </tr>"
    Response.Write "</table>"
	Response.Write "</div>" & vbCrlf
End Sub

Function GetUserGroup_Option()
    Dim strGroup, rsGroup
    strGroup = "_data.push(['0','全部会员']);"
	Call Exec(rsGroup,"select GroupID,GroupName from UserGroup order by GroupType asc,GroupID asc",2)
    Do While Not rsGroup.EOF
        strGroup = strGroup & "_data.push(['" & rsGroup(0) & "','" & rsGroup(1) & "']);"
        rsGroup.MoveNext
    Loop
    rsGroup.Close
    Set rsGroup = Nothing
    GetUserGroup_Option = strGroup
End Function
%>